<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();

    $form->get('userGroupName')->setAttributes([
        'placeholder' => $this->translate('客户组名称')
    ]);

    $form->get('integralStart')->setAttributes([
        'placeholder' => $this->translate('起始积分')
    ]);

    $form->get('integralEnd')->setAttributes([
        'placeholder' => $this->translate('结束积分')
    ]);
    ?>
    <?php echo $this->form()->openTag($form); ?>
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dbshop-menu-top">
            <a href="<?php echo $this->url('user-group');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回客户组列表'); ?></a>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('保存客户组'); ?></button>
            <?php echo $this->HelpUrl('userGroupAdd'); ?>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?php echo (isset($this->userGroup) ? $this->translate('编辑客户组') : $this->translate('添加客户组')); ?></h3>
                    </div>

                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('客户组名称'); ?><span class="must_add_value">*</span></label>
                            <div class="col-sm-6">
                                <?php echo $this->formElement($form->get('userGroupName')); ?>
                                <?php echo $this->formElementErrors($form->get('userGroupName'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('等级积分范围'); ?></label>
                            <div class="col-sm-2">
                                <?php echo $this->formElement($form->get('integralStart')); ?>
                                <?php echo $this->formElementErrors($form->get('integralStart'), ['class'=>'error-message']); ?>
                            </div>
                            <div class="col-sm-2">
                                <?php echo $this->formElement($form->get('integralEnd')); ?>
                                <?php echo $this->formElementErrors($form->get('integralEnd'), ['class'=>'error-message']); ?>
                            </div>
                            <div class="col-sm-2">
                                <div class="checkbox">
                                    <label>
                                        <?php echo $this->formElement($form->get('integralState')); ?><?php echo $this->translate('启用'); ?>
                                        <?php echo $this->formElementErrors($form->get('integralState'), ['class'=>'error-message']); ?>
                                    </label>
                                </div>
                            </div>
                        </div>

                    </div>

                </div>
            </div>
        </div>

    </section>
    <?php echo $this->form()->closeTag(); ?>

</div>
<script>
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                userGroupName: {
                    required: true
                }
            },
            messages: {
                userGroupName: {
                    required: "<?php echo $this->translate('客户组名称不能为空!'); ?>"
                }
            }
        });
    });
</script>
